package cn.rentaotao.spring.aop;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author rtt
 * @date 2022/5/7 16:13
 */
@Component
public class People {

    @Autowired
    Environment environment;

    @Value("${girl}")
    String u1;

    @Value("#{systemProperties['girl']}")
    String u2;

    @Value("#{systemEnvironment['girl']}")
    String u3;

    public String getName() {
        System.out.println(environment.getProperty("girl"));
        System.out.println(u2);
        System.out.println(u3);
        return u1 == null ? "default": u1;
    }
}
